# coding: utf-8
from sqlalchemy import Column, Integer, text
from sqlalchemy.dialects.mysql import INTEGER, TEXT, TINYINT, VARCHAR
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class BmFile(Base):
    __tablename__ = 'bm_files'

    id = Column(INTEGER, primary_key=True, nullable=False)
    project_id = Column(VARCHAR(255), primary_key=True, nullable=False)
    main_file_path = Column(VARCHAR(255))
    label_file_path = Column(VARCHAR(255))
    coord_file_path = Column(VARCHAR(255))
    update_time = Column(Integer, nullable=False)


class BmLog(Base):
    __tablename__ = 'bm_logs'

    id = Column(INTEGER, primary_key=True)
    type = Column(TINYINT, nullable=False, server_default=text("'1'"))
    level = Column(TINYINT, nullable=False, server_default=text("'1'"))
    data = Column(TEXT, nullable=False)
    create_time = Column(INTEGER, nullable=False)


class BmProject(Base):
    __tablename__ = 'bm_projects'

    id = Column(INTEGER, primary_key=True, nullable=False)
    email = Column(VARCHAR(255), primary_key=True, nullable=False)
    user_id = Column(VARCHAR(255), nullable=False)
    project_id = Column(VARCHAR(255), nullable=False)
    create_time = Column(Integer, nullable=False)


class BmUser(Base):
    __tablename__ = 'bm_users'

    id = Column(INTEGER, primary_key=True, nullable=False)
    name = Column(VARCHAR(255), unique=True)
    email = Column(VARCHAR(255), primary_key=True, nullable=False, unique=True)
    tel = Column(VARCHAR(20), unique=True)
    password = Column(VARCHAR(255), nullable=False)
    status = Column(TINYINT(1), nullable=False)
    remember_token = Column(VARCHAR(100))
    created_at = Column(Integer)
    updated_at = Column(Integer)
    url_path = Column(VARCHAR(300))
    real_path = Column(VARCHAR(300))


class Compound(Base):
    __tablename__ = 'compound'

    index = Column(INTEGER, primary_key=True)
    id = Column(VARCHAR(255))
    shape = Column(VARCHAR(255))
    coords = Column(VARCHAR(255))
    data_coords = Column('data-coords', VARCHAR(255))
    _class = Column('class', VARCHAR(255))
    href = Column(VARCHAR(255))
    title = Column(VARCHAR(255))
    data_entry = Column('data-entry', VARCHAR(255))


class Map(Base):
    __tablename__ = 'map'

    index = Column(INTEGER, primary_key=True)
    id = Column(VARCHAR(255))
    shape = Column(VARCHAR(255))
    coords = Column(VARCHAR(255))
    data_coords = Column('data-coords', VARCHAR(255))
    _class = Column('class', VARCHAR(255))
    href = Column(VARCHAR(255))
    title = Column(VARCHAR(255))
    data_entry = Column('data-entry', VARCHAR(255))


class React(Base):
    __tablename__ = 'react'

    index = Column(INTEGER, primary_key=True)
    id = Column(VARCHAR(255))
    shape = Column(VARCHAR(255))
    coords = Column(TEXT)
    data_coords = Column('data-coords', TEXT)
    _class = Column('class', VARCHAR(255))
    href = Column(TEXT)
    title = Column(TEXT)


class ReactionPair(Base):
    __tablename__ = 'reaction_pairs'

    id = Column(INTEGER, primary_key=True)
    reaction = Column(VARCHAR(255))
    compound1 = Column(VARCHAR(255))
    compound2 = Column(VARCHAR(255))
